Introduction
The Java Runtime Interpreter
Installation Configuration for Windows Platforms
Installation Configuration for Solaris Platforms
The Java Runtime Environment is the minimum standard Java Platform for running Java programs. It contains the Java virtual machine, Java core classes, and supporting files. The JRE does not contain any of the development tools (such as appletviewer or javac) or classes that pertain only to a development environment.
The current version of the JRE for Windows is bundled with its own installer program. An installer for the Solaris JRE will be provided in a future release.
This document provides information and suggestions that may be useful for developers who want to redistribute the JRE with their software. Other useful information may be found in the JRE README and CHANGES files.
To submit comments or suggestions about the JRE, please send mail to the most appropriate engineering team from the list at JavaSoft email addresses.
The JRE on both Windows and Solaris may be invoked by the command-line tool jre, the Java Runtime Interpreter, which is included in both the JRE download and the JDK download. For Windows platforms, the jrew tool is also available. jrew is similar to jre, but it doesn't create a console window when invoked.
In many respects, the jre tool is similar to the JDK's java tool. One important difference, however, is that the Windows version of the jre tool ignores the CLASSPATH environment variable. For both Windows and Solaris platforms, the -cp option of the jre tool is recommended for specifying an application's class path (see below).
The Java Runtime Interpreter provides two options not available with the JDK's Java Interpreter, java. These options are:
Prepends the specified path or paths to the base classpath or path given by the CLASSPATH environment variable. Each path should end with the directory containing the class file(s) to be executed. However, if a file to be executed is a zip or jar file, the path to that file must end with the file's name. Here is an example of an argument for -cp that specifies three paths consisting of the current directory and two additional paths:.:/home/xyz/classes:/usr/local/java/classes/MyClasses.jar
Specifies that any JIT compiler should be ignored and instead invokes the default Java interpreter.
Summaries of proper use of the jre and jrew commands and their options are on-line:
The JRE for Win 32 platforms is bundled with its own installer program. The availability of an easily installable JRE adds flexibility to the ways in which software suppliers can deliver software to their customers. Vendors of Java applications have the option of not bundling a copy of the JRE with their software. End-users can download and install the Windows JRE themselves. Once a user has installed the JRE, it can be used to run any number of Java applications.
The Windows JRE install program uses the Windows registry to record path and version information. Venders of Java applications can have their install software check the registry to determine which version, if any, of the JRE already exists on the platform. If an appropriate version of the JRE is not already installed, the user can be prompted to download and install it.
When installed, the JRE creates the following registry key:
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment
This key contains the following string value which is set to the major.minor version of the installed JRE:
Name |
Default Value |
---|---|
CurrentVersion | 1.1 |
In addition, a registry subkey is created using the major.minor version of the installed JRE. For example, installation of JRE 1.1.3 creates the following key:
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.1
This key contains the following string values which are used by the jre.exe and jrew.exe programs to obtain settings information for the runtime environment:
Name |
Default Value |
---|---|
JavaHome | C:\Program Files\JavaSoft\JRE\1.1 |
RuntimeLib | C:\Program Files\JavaSoft\JRE\1.1\bin\javai.dll |
MicroVersion | 3 |
Compiler | Not set by default |
JavaHome is set to the full path name of the directory in which the JRE was installed. RuntimeLib contains the full path name of the Java runtime DLL to use. MicroVersion identifies the micro-version of the JRE installed. For JRE 1.1.2, MicroVersion's value was 2. For JRE 1.1.3, the value is 3, etc. The value Compiler can be optionally set to the library name of a JIT-compiler DLL to use when running the VM. A JIT compiler can be temporarily disabled with the -nojit flag of jre.
By default, the jre program will use the above registry keys when looking for an installed JRE. If the required version of the JRE can not be found using the above registry settings, then jre.exe will default to the VM (javai.dll) that is installed in the same directory as the jre.exe program itself.
The JDK continues to bundle in its own copy of the JRE in order to maintain compatibility with applications that expect all classes to be in classes.zip. The JDK installer therefore creates a parallel set of registry keys and values under the following master key:
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Development Kit
The jre program can use either a separately installed JRE or the JRE bundled with the JDK, if present.
Source code for the jre tool is installed with the JDK in the jdk1.1.3\demo\jre\win32 folder. You may customize and redistribute this software.
To build jre.exe for Win32, you must first have Microsoft Visual C++ version 4.2 or later installed and located in your search path. The LIB environment variable must be set to include the [msvc]\lib directory. In addition, the INCLUDE variable must be set to include the directories [msvc]\include, [jdk]\include and [jdk]\include\win32, where [msvc] is the location of the MSVC++ directory and [jdk] is the location of the JDK 1.1.3 directory.
You can set the path and relevant environment variables as follows:
C> set PATH=[msvc]\bin;%PATH% C> set LIB=[msvc]\lib C> set INCLUDE=[jdk]\include;[jdk]\include\win32;[msvc]\include
To build both jre.exe and jrew.exe, type nmake from the command line.
You can use the makefile variable VERSION to specify which version of the JRE that jre.exe should use at start up. If VERSION is not set, then JRE version 1.1.3 will be used by default. If VERSION is set to a version string, then the specified version of the JRE will be used. If VERSION is set to an empty string, then the latest version of the JRE will be used. For example,
C> nmake VERSION=1.1
will use any 1.1 JRE installed on the system,
C> nmake VERSION=1.1.3
will use only JRE 1.1.3, assuming it's installed on the system, and
C> nmake VERSION=
will use the latest version of the JRE installed.
If native code support is required on Win32 platforms, the native library must be located in the executable search PATH.
The Solaris JRE is not bundled with an installer. Software vendors should bundle the JRE and an installer with the Java software they supply to end-users.
There are several ways that the directory heirarchy of the JRE and application software can be structured. A suggested directory structure is as follows:
[app-dir] ________________|___________ | | | bin lib [runtime-dir] | | ________|________ app.jar | | bin lib | |
This structure shows the JRE installed in its own subdirectory, referred to as [runtime-dir]. This directory would include all of the JRE's required files (as listed in the JRE README file) in the bin and lib sub-directories. The bin and lib directories beneath [runtime-dir] should have the same directory hierarchy and relative placement of files as the bin and lib directories created upon installation of the JRE. Optional internationalization files can be included for language localization support, if desired.
The example directory structure above shows all application-specific classes in the file [app-dir]/lib/app.jar. To make maintenance of the software easier, it is recommend that application-specific software be placed in a directory than the JRE's directory, as in the example.
If native code support is required, then the native library must be located in LD_LIBRARY_PATH. The best way to do this in the above example would be to install the native libraries in [app-dir]/lib/[sys]. LD_LIBRARY_PATH would then be set to include these directories.
The application can be invoked with the jre command-line tool, using the -cp option to specify the application's class path. In the example directory tree above, for example, the command might look like this:
/ /bin/jre -cp /lib/app.jar
Source code for the Solaris jre tool can be found in the jdk1.1.3/demo/jre/solaris directory. You may customize and redistribute this software.
Last modified: Wed Jul 23 16:58:56 PDT